package io.aggression.test.model;

import java.util.HashMap;

public class User {

    private String userId;
    private String emailAddr;
    private String password;
    private String roles;

    private HashMap rawDetails;

    //TODO: Support multiple roles
    private User(HashMap d){

        rawDetails = d;

        userId = (String)rawDetails.get("user_id");
        emailAddr = (String)rawDetails.get("email_addr");
        password = (String)rawDetails.get("password");
        roles = (String)rawDetails.get("group");
    }

    public String getUserId(){
        return userId;
    }

    public String getPassword(){
        return password;
    }

    public String getEmailAddr(){
        return emailAddr;
    }


    private User(String id, String email, String pass  ){
        userId = id;
        emailAddr = email;
        password = pass;
    }

    public static class Builder {

        private String userId;
        private String emailAddr;
        private String password;

        private HashMap details;

        public Builder details(HashMap d){

            details = d;
            return this;

        }

        public User build(){
            return new User(details);
        }

        public Builder id(String id){
            userId = id;
            return this;
        }

    }
}
